import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { SpecialOperationCertificateForm, SpecialOperationCertificateQuery, SpecialOperationCertificateVO } from './types';

/**
 * 查询特种作业证列表
 * @param query
 * @returns {*}
 */

export const listSpecialOperationCertificate = (query?: SpecialOperationCertificateQuery): AxiosPromise<SpecialOperationCertificateVO[]> => {
  return request({
    url: '/proj/specialOperationCertificate/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询特种作业证详细
 * @param certificateId
 */
export const getSpecialOperationCertificate = (certificateId: string | number): AxiosPromise<SpecialOperationCertificateVO> => {
  return request({
    url: '/proj/specialOperationCertificate/' + certificateId,
    method: 'get'
  });
};

/**
 * 新增特种作业证
 * @param data
 */
export const addSpecialOperationCertificate = (data: SpecialOperationCertificateForm) => {
  return request({
    url: '/proj/specialOperationCertificate',
    method: 'post',
    data: data
  });
};

/**
 * 修改特种作业证
 * @param data
 */
export const updateSpecialOperationCertificate = (data: SpecialOperationCertificateForm) => {
  return request({
    url: '/proj/specialOperationCertificate',
    method: 'put',
    data: data
  });
};

/**
 * 删除特种作业证
 * @param certificateId
 */
export const delSpecialOperationCertificate = (certificateId: string | number | Array<string | number>) => {
  return request({
    url: '/proj/specialOperationCertificate/' + certificateId,
    method: 'delete'
  });
};
